home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir26 / epi601_3.zip / FILES11.EXE / TIME.PGM < prev    next >
Text File  |  1994-08-22  |  9KB  |  245 lines

  1. *=============================== TIME.PGM ===================================
  2. *    Surveillance Information System Demo: updating time data ...
  3. *
  4. * Epi Info program that reads communicable disease surveillance files, 
  5. * produces disease specific aggregated files for use in graphic package. 
  6. * It outputs ASCII comma delimited files that can be retrieved in any 
  7. * graphic software such as Harvard graphics (DOS 2,3, or Windows) or 
  8. * Freelance graphics, using templates.
  9. *
  10. * READS        : SUMXX   .REC x (YEARBACK + 1)
  11. * USES        :
  12. * PRODUCES    : XXXXX   .DAT
  13. *
  14. * LAST UPDATE 06/06/94 Denis Coulombier
  15. *
  16. *============================================================================
  17.  
  18.  
  19. *============================== Initialization section ======================
  20. SET IGNORE=OFF SPLIT=OFF NOECHO=ON COLOR = 31 30 112
  21. CLS
  22.  
  23. *-------------------- Global variables declarations ---------------------
  24. DEFINE HGVERSION  #     GLOB 3
  25. * HGVERSION corresponds to the Harvard Graphic version used. 2 for 2.x
  26. * and 3 for version 3. Both version treat differently ASCII data
  27. * when importing.
  28.  
  29. DEFINE CURYEAR    ##    GLOB 
  30. IMMEDIATE CURYEAR = SYSTEMDATE[7,2]
  31. * The current year defaults to the system year. You can change this by
  32. * commenting out last line and changing the declaration 
  33. * of this year as follows: DEFINE CURYEAR ## GLOB 93
  34.  
  35. DEFINE CURDIS ____________________ GLOB
  36. * Hold the name of the current disease for updating title in HG3
  37.  
  38. DEFINE DUMYEAR    ##    GLOB @CURYEAR
  39. DEFINE YEARBACK   #     GLOB 4
  40. * YEARBACK specifies the additional number of years you want to consider for 
  41. * building historical trends. If YEARBACK = 3, then 4 summary files will be 
  42. * open since it requires four files to have the past 156 weeks (3 years)
  43.  
  44. DEFINE FILES STRING WIDTH=50 GLOB "SUM@CURYEAR "
  45. * Holds the name of the summary files to open
  46.  
  47. DEFINE COUNTER    ##    GLOB
  48. DEFINE CUREVENT   ##### GLOB
  49. * Disease under consideration
  50.  
  51. DEFINE LASTWEEK   ##    GLOB
  52. * last week of the current year
  53.  
  54. *-------------------- Checks last week of CURYEAR ---------------------------
  55. READ SUM@CURYEAR
  56. IF MMWRWK > COUNTER THEN COUNTER = MMWRWK
  57. * Checks the latest MMWR week entered and loads it into LASTWEEK
  58. GOTO PROG_SCR
  59. ECHO
  60. ECHO                   Current dataset:  SUM@CURYEAR
  61. ECHO
  62. ECHO             Calculating the last MMWRWK entered in 19@THISYEAR             
  63. ECHO
  64. ECHO
  65. SET NOECHO=ON
  66. PROCESS
  67. CLS
  68. SET NOECHO=ON
  69. IMMEDIATE LASTWEEK = COUNTER
  70. *-------------------- Determines files to be opened ---------------------------
  71.  
  72. IMMEDIATE COUNTER = YEARBACK
  73. :LOOPFILE
  74.   IMMEDIATE DUMYEAR = DUMYEAR - 1
  75.   IMMEDIATE COUNTER = COUNTER - 1
  76.   IMMEDIATE FILES = FILES + "SUM@DUMYEAR "
  77.   IMMEDIATE IF COUNTER > 0 THEN \
  78. GOTO LOOPFILE
  79. * This loop decrement the year YEARBACK times, and append the name of the 
  80. * file to FILES which will be READ later
  81. *===========================End Initialization section ======================
  82.  
  83.  
  84. *============================ Main Program section ===========================
  85. * This main program section contains code for selecting disease, and then
  86. * calls a sub routine to process the file.
  87. * This "structured" approach allows easy maintenance of the code since
  88. * only one copy of the code for any specific disease is necessary
  89. *
  90. * The only thing necessary to add a disease in the list are the 2 statements
  91. * IMMEDIATE CUREVENT=XXXXX
  92. * GOTO PROC_DISEAS
  93. * Customized to the disease code of interest
  94.  
  95. *--- Salmonellosis ---
  96. IMMEDIATE CUREVENT=11000
  97. GOTO PROC_DISEAS
  98.  
  99. *--- Gonorrhea ---
  100. IMMEDIATE CUREVENT=10280
  101. GOTO PROC_DISEAS
  102.  
  103. *--- Hepatitis B ---
  104. IMMEDIATE CUREVENT=10100
  105. GOTO PROC_DISEAS
  106.  
  107. *--- Measles ---
  108. IMMEDIATE CUREVENT=10500
  109. GOTO PROC_DISEAS
  110.  
  111. *--- Hemophilus Influenzae ---
  112. IMMEDIATE CUREVENT=10590
  113. GOTO PROC_DISEAS
  114.  
  115. * Clean up and QUIT
  116. RUN CONFIG.EPI
  117. READ STATUS
  118. IF REPORTCODE = 4 THEN UPDATEDATE = SYSTEMDATE
  119. IF REPORTCODE = 4 THEN UPDATETIME = SYSTEMTIME
  120. ERASE ~.REC
  121. ROUTE ~.REC
  122. WRITE RECFILE REPORTNAME REPORTCODE UPDATEDATE UPDATETIME
  123. ROUTE SCREEN
  124. READ ~.REC
  125. ERASE STATUS.REC
  126. CLOSE ~.REC
  127. RENAME ~.REC STATUS.REC
  128. ERASE ~.REC
  129. QUIT
  130. *=========================End Main Program section ===========================
  131.  
  132. *========================= Sub routine: PROC_DISEAS ========================== 
  133. * This section creates a summary file with PLACE and PERSON specific 
  134. * information, aggregated by TIME characteristics.
  135. * The file generated will be used by GRAPHIC software to display data
  136. * This example uses salmonellosis notification (EVENT=11000)
  137. * Any disease can be added by copying the disease specific section
  138. * and changing the IMMEDIATE CUREVENT statement
  139. *------------------------- Data section -------------------------------------
  140. :PROC_DISEAS
  141. READ @FILES
  142. DEFINE SERIE ###
  143. * Serial holds the week number of the past YEARBACK*52 weeks
  144.  
  145. SERIE = MMWRWK - LASTWEEK + ((YEARBACK - (CURYEAR - YEAR)) * 52)
  146. * Numbers the week from 1 to YEABACK * 52, corresponding to the 
  147. * last YEARBACK number of years of data
  148.  
  149. SELECT SERIE > 0 AND <= (YEARBACK * 52) 
  150. SELECT EVENT = CUREVENT
  151. ** SELECT any optional PLACE characteristics such as county
  152.  
  153. *------------------------- Process section ----------------------------------
  154. ERASE ~.REC
  155. ROUTE ~.REC
  156. GOTO PROG_SCR
  157. ECHO
  158. ECHO           Routing output to a temporary file ~.REC
  159. ECHO
  160. ECHO             Current dataset: @FILES
  161. ECHO               Current event: @CUREVENT
  162. ECHO                Current Week: @LASTWEEK 
  163. ECHO                Current year: 19@CURYEAR
  164. ECHO
  165. SET NOECHO=ON
  166. OUTPUT SUMFREQ COUNT SERIE
  167. SET NOECHO=ON
  168. CLS
  169. * 2nd level of aggregation, by week number, in a temporary file
  170.  
  171. READ DISEASES
  172. IF EVENT = CUREVENT THEN CURDIS = DISEASE
  173. PROCESS
  174. ERASE @CUREVENT.DAT
  175. ROUTE @CUREVENT.DAT
  176. IMMEDIATE IF HGVERSION = 2 THEN TYPE ",Up to Week # @LASTWEEK of 19@CURYEAR"
  177. IMMEDIATE IF HGVERSION = 3 THEN \
  178. TYPE "Notifications of @CURDIS\nState of Michigan, as of Week # @LASTWEEK, 19@CURYEAR"
  179. * In Harvard graphics 2.x, the first record of an ASCII comma delimited
  180. * file may be used to update the legend. In Harvard 3, every attributes of 
  181. * the graph may be updated from an ASCII file, including the title,
  182. * axis title. If you use HG3, you can add as many TYPE statement as you
  183. * wish. You will have to customize the link in the IMPORT ASCII DELIMITED
  184. * feature of HG3
  185.  
  186. READ WEEK.REC
  187. RELATE SERIE ~.REC
  188. * WEEK.REC file has only one variable, SERIE, taking values from 1 to 400
  189. * By relating from this file to the file newly aggregated, we ensure
  190. * that all weeks are represented whether or not cases were notified. 
  191. * OUTPUT SUMFREQ does not produce one record for weeks not represented in 
  192. * the data file. These missing weeks are recoded from missing to 0 
  193. * (RECODE COUNT .=0)
  194.  
  195. SELECT SERIE > 0 AND <= (YEARBACK * 52) 
  196. RECODE COUNT .=0
  197.  
  198. GOTO PROG_SCR
  199. ECHO
  200. IMMEDIATE IF HGVERSION = 2 THEN \
  201. ECHO    Routing output in ASCII format for Harvard Graphics 2.x  ELSE \
  202. ECHO    Routing output in ASCII format for Harvard Graphics 3.x 
  203. ECHO
  204. ECHO             Current dataset: @FILES
  205. ECHO               Current event: @CUREVENT
  206. ECHO                Current Week: @CURWEEK 
  207. ECHO                Current year: 19@CURYEAR
  208. ECHO
  209. SET NOECHO=ON
  210. WRITE SERIE,",",COUNT
  211. SET NOECHO=ON
  212. CLS
  213. * Output 2 series in the .DAT file, separated by a comma
  214. *    1,   12
  215. *    2,    4
  216. *    3,    8
  217. * .....
  218. ROUTE SCREEN
  219. RETURN
  220. *======================End Sub routine: PROC_DISEAS ========================== 
  221.  
  222. *========================= Sub routine: PROG_SCR ============================= 
  223. :PROG_SCR
  224. CLS
  225. SET NOECHO=OFF
  226. ECHO ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  227. ECHO ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  228. ECHO ▓▓▓▓▓▓▓╔════════════════════════════════════════════════════════════════╗▓▓▓▓▓▓
  229. ECHO ▓▓▓▓▓▓▓║                                                                ║░▓▓▓▓▓
  230. ECHO ▓▓▓▓▓▓▓║                    N E T S S    R E P O R T S                  ║░▓▓▓▓▓
  231. ECHO ▓▓▓▓▓▓▓║                                                                ║░▓▓▓▓▓
  232. ECHO ▓▓▓▓▓▓▓╠════════════════════════════════════════════════════════════════╣░▓▓▓▓▓
  233. ECHO ▓▓▓▓▓▓▓║                                                                ║░▓▓▓▓▓
  234. ECHO ▓▓▓▓▓▓▓║     »  Please be patient ........                              ║░▓▓▓▓▓
  235. ECHO ▓▓▓▓▓▓▓║                                                                ║░▓▓▓▓▓
  236. ECHO ▓▓▓▓▓▓▓║     »  Running report TIME.PGM                                 ║░▓▓▓▓▓
  237. ECHO ▓▓▓▓▓▓▓║                                                                ║░▓▓▓▓▓
  238. ECHO ▓▓▓▓▓▓▓╚════════════════════════════════════════════════════════════════╝░▓▓▓▓▓
  239. ECHO ▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓
  240. ECHO ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  241. ECHO ═══════════════════════════════════════════════════════════════════════════════
  242. RETURN
  243. *====================== End Sub routine: PROC_DISEAS ========================== 
  244.